<template>
	<view class="myTestWrap">
		<view class="myTestTitle">
			<view class="">题目：{{ quesList.title }}</view>
			<!-- {{ quesList.file_path }} -->
			<view class="imgquestions"><image :src="url + 'uploadPath/question/' + quesList.file_name" mode=""></image></view>
		</view>
		<view class="answer">
			<view class="">答案：</view>
			<!-- {{ quesList.file_path }} -->
			<view class="imgquestionsAnswer" v-for="(item, index) in quesAsync.answer" :key="item.id">
				<image :src="url + 'uploadPath/' + item.filePath" mode="widthFix"></image>
			</view>
		</view>
		<template v-if="quesAsync.pizhu.filePath">
			<view class="myTestTitle pizhu">批注：</view>
			<!-- {{ quesList.file_path }} -->
			<view class="imgquestions"><image :src="url + 'uploadPath/' + quesAsync.pizhu.filePath" mode=""></image></view>
			<view class="">结果：{{ quesAsync.pizhu.status }}</view>
			<view class="">评语：{{ quesAsync.pizhu.remarks }}</view>
		</template>

		<!-- <view class="Subtitle_tright">
				<view class="testSuccess" v-if="true">测试结果： 正确</view>
				<view class="testError" v-if="false">测试结果： 错误</view>
			</view> -->

		<view class=""></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			quesList: {},
			questionId: '',
			userId: '',
			url: '',
			quesAsync: []
		};
	},
	onLoad(e) {
		console.log(e, 'lllll');
		// uni.setStorageSync('quesList', JSON.parse(e.item));
		const Id = uni.getStorageSync('Id');
		if (Id) {
			this.userId = Id;
		}
		const quesList = JSON.parse(e.item);
		if (quesList) {
			this.quesList = quesList;
			this.questionId = quesList.id;
		}
		console.log(this.userId, this.questionId);
	},
	mounted() {
		this.$http({
			url: `question/lookResult?userId=${this.userId}&questionId=${this.questionId}`,
			method: 'POST'
		})
			.then(res => {
				console.log(res.data, 'shuj11111');
				if (res.code == 200) {
					// uni.setStorageSync('accessType', res.data);
					this.quesAsync = res.data;
				} else if (res.code == 500) {
					uni.showToast({
						title: '该题目还没有答题,请您前往答题区域',
						icon: 'none'
					});
				}
			})
			.catch(err => {});
		this.url = this.$formalUrl;
	},

	methods: {}
};
</script>

<style lang="scss" scoped>
.myTestWrap {
	padding: 24rpx;
	width: 100%;
	height: 100%;
	// margin: 0 auto;

	//我的标题
	.myTestTitle {
		// background: red;
		width: 684rpx;
		font-size: 40rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #2a3447;
		line-height: 48rpx;
		.imgquestions {
			margin: 10rpx 0;
			image {
				width: 100%;
			}
		}
	}

	// 题数 和错误和正确
	// .Subtitle {
	// 	width: 100%;
	// 	// display: flex;
	// 	justify-content: space-between;
	// 	margin-top: 25rpx;

	// 	// 右侧
	// 	.Subtitle_tright {
	// 		margin-right: 70rpx;

	// 		.testSuccess {
	// 			color: #00ac49;
	// 		}

	// 		.testError {
	// 			color: #d80000;
	// 		}
	// 	}
	// }

	//答案
	.answer {
		width: 100%;
		font-size: 40rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #2a3447;
		line-height: 48rpx;
		.imgquestionsAnswer {
			width: 33.333%;
			height: 33.333%;
			float: left;
			image {
				width: 100%;
				height: 100%;
				margin: 10rpx;
			}
			// width: 33.33%;
		}
	}
	.pizhu {
		clear: both;
	}
}
</style>
